<tr id="imageDiv<%= g.options[:child_index] || g.object.id %>">
	<% if !g.object || g.object.new_record? %>
		<td>[<a href="" onclick="insertImage('upload<%= g.options[:child_index] %>');return false;">Insert</a>]</td>
		<td></td>
		<td><%= g.options[:child_index] %></td>
		<td>
			<%= g.file_field(:image, :size => '10') %>
			<%= g.hidden_field :random_id, :value => g.options[:child_index] %>
		</td>
	<% else %>
		<td>[<a href="" onclick="insertImage(<%= g.object.id %>);return false;">Insert</a>]</td>
		<td><img src="<%= g.object.image.url(:thumb) %>" /></td>
		<td><%= g.object.id %></td>
		<td class="imageFileName"><%= g.object.image_file_name %></td>
	<% end %>
	<td>
		[<%= link_to_function('delete', "removeImage(#{g.options[:child_index] || g.object.id})") %>]
		<% if ((["2", "3", "7"] <=> Rails::VERSION::STRING.split('.')) < 0) %>
			<%= g.hidden_field :_destroy, :id => "image_#{g.options[:child_index] || g.object.id}" %>
		<% else %>
			<%= g.hidden_field :_delete, :id => "image_#{g.options[:child_index] || g.object.id}" %>
		<% end %>
	</td>
</tr>
